﻿using BarcodePrinting;
using OrderSystem.Common;
using OrderSystem.DataAccess;
using OrderSystem.FormatOutput;
using OrderSystem.SystemFramework;
using OrderSystem.Templet;
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Windows.Forms;

namespace OrderSystem
{
    public partial class FormShatterInfo : FormTemplet
    {
        private DataTable _dtShatterItems = null;

        private FormAddShatterItem frmAddShatterItem;

        private long _nShatterID = -1L;

        private string _sShatterNumber = null;

        private string _sDate = null;

        private bool _isLocked = true;

        private string _sRemark = null;

        private string _sOperatorName = null;

        public FormShatterInfo()
        {
            this.InitializeComponent();
        }

        public FormShatterInfo(string sShatterNumber) : this()
        {
            this._sShatterNumber = sShatterNumber;
            DataTable dataTable = null;
            Shatters shatters = new Shatters();
            try
            {
                dataTable = shatters.LoadShatterByShatterNumber(this._sShatterNumber);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            catch (Exception ex2)
            {
                MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            shatters.Dispose();
            if (dataTable != null)
            {
                if (dataTable.Rows.Count > 0)
                {
                    this._nShatterID = (long)Convert.ToInt32(dataTable.Rows[0][0]);
                    this._sDate = dataTable.Rows[0][2].ToString();
                    this._isLocked = Convert.ToBoolean(dataTable.Rows[0][3]);
                    this._sRemark = dataTable.Rows[0][4].ToString();
                    this._sOperatorName = dataTable.Rows[0][5].ToString();
                    this.txtShatterNumber.Text = this._sShatterNumber;
                    this.txtDate.Text = this._sDate;
                    this.chkLockedData.Checked = this._isLocked;
                    this.txtRemark.Text = this._sRemark;
                    this.txtOperatorName.Text = this._sOperatorName;
                }
                else
                {
                    MessageBox.Show("没有查询到此订单", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                dataTable.Dispose();
            }
            this.RefreshItems();
        }

        private void RefreshItems()
        {
            if (this._dtShatterItems != null)
            {
                this._dtShatterItems.Dispose();
                this._dtShatterItems = null;
            }
            ShatterItems shatterItems = new ShatterItems();
            try
            {
                this._dtShatterItems = shatterItems.GetShatterItems(this._nShatterID);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！\r\n\r\n数据可能没有读出来", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            catch (Exception ex2)
            {
                MessageBox.Show(ex2.Message + "\r\n\r\n数据可能没有读出来", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            shatterItems.Dispose();
            if (this._dtShatterItems != null)
            {
                this.dgShatters.DataSource = null;
                this.dgShatters.DataSource = this._dtShatterItems;
                this.dgShatters.AutoResizeColumns();
            }
            else
            {
                MessageBox.Show("加载此订单的数据失败！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }

        public void ReloadItemForInsert(string sProductID)
        {
            if (this._dtShatterItems == null)
            {
                MessageBox.Show("数据容器是空，可能还有数据保存在数据库，但没有加载到容器中，你可以从新打开此订单试一试，但是现有数据将加载在此容器中", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this._dtShatterItems = new DataTable("OrderItem");
                this._dtShatterItems.Columns.Add(new DataColumn("产品ID", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("类型", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("单位", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("编号", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("宽", Type.GetType("System.Double", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("宽(短边)", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("高", Type.GetType("System.Double", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("高(短边)", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("数量", Type.GetType("System.Int32", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("备注", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("工艺", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("补片层名称", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("补片数量", Type.GetType("System.Int32", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("补片面积", Type.GetType("System.Double", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("工作组", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("补片原因", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("客户", Type.GetType("System.String", true, true)));
                this._dtShatterItems.Columns.Add(new DataColumn("计划", Type.GetType("System.String", true, true)));
            }
            DataTable dataTable = null;
            ShatterItems shatterItems = new ShatterItems();
            try
            {
                dataTable = shatterItems.LoadShatterItem(this._nShatterID, sProductID);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            catch (Exception ex2)
            {
                MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            shatterItems.Dispose();
            if (dataTable != null)
            {
                if (dataTable.Rows.Count > 0)
                {
                    DataRow dataRow = this._dtShatterItems.NewRow();
                    for (int i = 0; i < this._dtShatterItems.Columns.Count; i++)
                    {
                        dataRow[i] = dataTable.Rows[0][i];
                    }
                    this._dtShatterItems.Rows.Add(dataRow);
                    this._dtShatterItems.AcceptChanges();
                }
                else
                {
                    MessageBox.Show("没有查询到此项数据！", "提示！", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                dataTable.Dispose();
            }
            for (int i = 0; i < this._dtShatterItems.Rows.Count; i++)
            {
                if (this.dgShatters.Rows[i].Cells[0].Value.ToString() == sProductID)
                {
                    this.dgShatters.CurrentCell = this.dgShatters.Rows[i].Cells[0];
                    this.dgShatters.Rows[i].Selected = true;
                    break;
                }
            }
            this.dgShatters.AutoResizeColumns();
        }

        private void FormOrderInfo_Load(object sender, EventArgs e)
        {
            this.dgShatters.AutoResizeColumns();
        }

        private void btnAddItem_Click(object sender, EventArgs e)
        {
            this.menuAddItem_Click(null, null);
        }

        private void menuAddItem_Click(object sender, EventArgs e)
        {
            if (this.chkLockedData.Checked)
            {
                MessageBox.Show("此补片单已经锁定，不能进行编辑", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                if (this.frmAddShatterItem == null || this.frmAddShatterItem.IsDisposed)
                {
                    this.frmAddShatterItem = new FormAddShatterItem(this._nShatterID, this);
                    this.frmAddShatterItem.MdiParent = base.MdiParent;
                }
                this.frmAddShatterItem.Show();
                this.frmAddShatterItem.Activate();
            }
        }

        private void btnDeleteItem_Click(object sender, EventArgs e)
        {
            this.menuDeleteItem_Click(null, null);
        }

        private void menuDeleteItem_Click(object sender, EventArgs e)
        {
            if (this.chkLockedData.Checked)
            {
                MessageBox.Show("此补片单已经锁定，不能进行编辑", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                try
                {
                    string text = this.dgShatters.Rows[0].Cells[0].Value.ToString();
                }
                catch
                {
                    MessageBox.Show("表格中没有数据", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                int rowIndex = this.dgShatters.CurrentCell.RowIndex;
                if (MessageBox.Show("是否真的要删除这些选中的数据吗 ？", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Cancel)
                {
                    ShatterItems shatterItems = new ShatterItems();
                    bool flag = false;
                    try
                    {
                        flag = shatterItems.DeleteShatterItem(this._nShatterID, this.dgShatters.Rows[rowIndex].Cells[0].Value.ToString(), LoginInfo.OperatorID);
                    }
                    catch (SqlException ex)
                    {
                        int number = ex.Number;
                        if (number != 50001)
                        {
                            switch (number)
                            {
                                case 50500:
                                    MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                    break;
                                case 50501:
                                    MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                    this.chkLockedData.Checked = true;
                                    break;
                                default:
                                    MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                                    break;
                            }
                        }
                        else
                        {
                            MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                    catch (Exception ex2)
                    {
                        MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    shatterItems.Dispose();
                    if (flag)
                    {
                        for (int i = 0; i < this._dtShatterItems.Rows.Count; i++)
                        {
                            if (this._dtShatterItems.Rows[i][0].ToString() == this.dgShatters.Rows[rowIndex].Cells[0].Value.ToString())
                            {
                                this._dtShatterItems.Rows[i].Delete();
                                this._dtShatterItems.AcceptChanges();
                                break;
                            }
                        }
                    }
                }
            }
        }

        private void menuRefresh_Click(object sender, EventArgs e)
        {
            this.RefreshItems();
        }

        private void btnCreateShatter_Click(object sender, EventArgs e)
        {
            this.menuCreateShatter2_Click(null, null);
        }

        private void menuCreateShatter_Click(object sender, EventArgs e)
        {
            if (this._nShatterID == -1L)
            {
                MessageBox.Show("加载数据时出现了错误", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                Shatters shatters = new Shatters();
                int num = -2;
                try
                {
                    num = shatters.GetPrintedQuantity(this._sShatterNumber);
                }
                catch (SqlException ex)
                {
                    MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                catch (Exception ex2)
                {
                    MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                shatters.Dispose();
                if (num > -1)
                {
                    if (num > 0)
                    {
                        if (MessageBox.Show("此单已经打印了 " + num.ToString() + " 次，是否继续此次打印？", "提示！", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            return;
                        }
                    }
                }
                else if (num == -1)
                {
                    MessageBox.Show("没有找到此单！", "提示！", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                DataTable dataTable = null;
                ShatterItems shatterItems = new ShatterItems();
                try
                {
                    dataTable = shatterItems.GetDataForShatterForm(this._nShatterID);
                }
                catch (SqlException ex)
                {
                    MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                catch (Exception ex2)
                {
                    MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                shatterItems.Dispose();
                if (dataTable != null)
                {
                    if (dataTable.Rows.Count <= 0)
                    {
                        MessageBox.Show("没有找到数据信息！", "提示！", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        dataTable.Dispose();
                    }
                    else
                    {
                        this.saveFileDialog1.Filter = "Excel文件|*.xls";
                        this.saveFileDialog1.Title = "请选择你要输入的路径和文件名";
                        this.saveFileDialog1.FileName = this._sShatterNumber + ".xls";
                        string text = null;
                        if (this.saveFileDialog1.ShowDialog() == DialogResult.OK)
                        {
                            text = this.saveFileDialog1.FileName;
                            this.saveFileDialog1.Dispose();
                            try
                            {
                                File.Copy(Application.StartupPath + "\\model\\" + AppSettings.GetExcelSettings("shatter"), text, true);
                            }
                            catch (IOException ex3)
                            {
                                MessageBox.Show(ex3.Message + "\r\n或者是: 和你要创建的相同文件名的目标文件正在使用，不能覆盖，请把它关闭或删除后在操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                dataTable.Dispose();
                                return;
                            }
                            catch (Exception ex2)
                            {
                                MessageBox.Show(ex2.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                dataTable.Dispose();
                                return;
                            }
                            shatters = new Shatters();
                            bool flag = false;
                            try
                            {
                                flag = shatters.PrintOnce(this._sShatterNumber);
                            }
                            catch (SqlException ex)
                            {
                                MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                            }
                            catch (Exception ex2)
                            {
                                MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            shatters.Dispose();
                            if (flag)
                            {
                                try
                                {
                                    ExcelOperationShatter excelOperationShatter = new ExcelOperationShatter(Application.StartupPath);
                                    excelOperationShatter.MakeShatterDataToExcel(text, dataTable, this._sShatterNumber, DateTime.Parse(this._sDate).ToShortDateString(), this._sOperatorName);
                                }
                                catch (Exception ex2)
                                {
                                    MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                }
                                dataTable.Dispose();
                            }
                        }
                        else
                        {
                            this.saveFileDialog1.Dispose();
                            dataTable.Dispose();
                        }
                    }
                }
            }
        }

        private void menuCreateShatter2_Click(object sender, EventArgs e)
        {
            if (this._nShatterID == -1L)
            {
                MessageBox.Show("加载数据时出现了错误", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                this.saveFileDialog1.Filter = "Excel文件|*.xls";
                this.saveFileDialog1.Title = "请选择你要输入的路径和文件名";
                this.saveFileDialog1.FileName = this._sShatterNumber + ".xls";
                string text = null;
                if (this.saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    text = this.saveFileDialog1.FileName;
                    this.saveFileDialog1.Dispose();
                    try
                    {
                        File.Copy(Application.StartupPath + "\\model\\Shatter_2.xls", text, true);
                    }
                    catch (IOException ex)
                    {
                        MessageBox.Show(ex.Message + "\r\n或者是: 和你要创建的相同文件名的目标文件正在使用，不能覆盖，请把它关闭或删除后在操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    catch (Exception ex2)
                    {
                        MessageBox.Show(ex2.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    try
                    {
                        ExcelOperationShatter excelOperationShatter = new ExcelOperationShatter(Application.StartupPath);
                        excelOperationShatter.MakeShatterDataToExcel2(text, this._dtShatterItems, this._sShatterNumber, DateTime.Parse(this._sDate).ToShortDateString(), this._sOperatorName);
                    }
                    catch (Exception ex2)
                    {
                        MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    this.saveFileDialog1.Dispose();
                }
            }
        }

        private void menuPrintBarCodeLabel_Click(object sender, EventArgs e)
        {
            if (!LoginInfo.Role[PowerName.Order_PrintLabel])
            {
                MessageBox.Show("你没有操作这里的权限！", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            //else if (!this._isLocked)
            //{
            //    MessageBox.Show("此订单需要销售 审核、锁定 后方能打印标签！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            //}
            else if (this._nShatterID == -1L)
            {
                MessageBox.Show("加载数据时出现了错误", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                LabelModel[] array = new LabelModel[this._dtShatterItems.Rows.Count];
                for (int i = 0; i < this._dtShatterItems.Rows.Count; i++)
                {
                    array[i] = new LabelModel(this._dtShatterItems.Rows[i]["计划"].ToString(), this._dtShatterItems.Rows[i]["客户"].ToString(), this._dtShatterItems.Rows[i]["计划"].ToString(), this._dtShatterItems.Rows[i]["产品ID"].ToString(), this._dtShatterItems.Rows[i]["补片层名称"].ToString(), this._dtShatterItems.Rows[i]["单位"].ToString(), this._dtShatterItems.Rows[i]["编号"].ToString(), Convert.ToDouble(this._dtShatterItems.Rows[i]["宽"]), this._dtShatterItems.Rows[i]["宽(短边)"].ToString(), Convert.ToDouble(this._dtShatterItems.Rows[i]["高"]), this._dtShatterItems.Rows[i]["高(短边)"].ToString(), "", Convert.ToInt32(this._dtShatterItems.Rows[i]["补片数量"]), 0m, this._dtShatterItems.Rows[i]["备注"].ToString(), this._dtShatterItems.Rows[i]["工艺"].ToString(), 1, Convert.ToInt32(this._dtShatterItems.Rows[i]["补片数量"]), 1, "");
                }
                if (MessageBox.Show("是否按照数据库打印？", "提示！", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    string productType = array[0].ProductType;
                    string text = InputBox.ShowBox("请输入你要打印标签所要更改的类型...", productType);
                    if (text == null)
                    {
                        return;
                    }
                    if (text.Trim().Length <= 0)
                    {
                        MessageBox.Show("你没有输入数据！", "提示！", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (array[i].ProductType == productType)
                        {
                            array[i].ProductType = text;
                        }
                        else
                        {
                            productType = array[i].ProductType;
                            text = InputBox.ShowBox("请输入你要打印标签所要更改的类型...", productType);
                            if (text == null)
                            {
                                return;
                            }
                            if (text.Trim().Length <= 0)
                            {
                                MessageBox.Show("你没有输入数据！", "提示！", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }
                            array[i].ProductType = text;
                        }
                    }
                }
                BarcodePrinter barcodePrinter = null;
                try
                {
                    barcodePrinter = new Printer_General_BuPian();
                    barcodePrinter.PrintPreview(array);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "错误！", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                if (barcodePrinter != null)
                {
                    barcodePrinter.Dispose();
                }
            }
        }

        private void menuPrintChoiceLabel_Click(object sender, EventArgs e)
        {
        }

        private void menuLockData_Click(object sender, EventArgs e)
        {
            Shatters shatters = new Shatters();
            bool flag = false;
            try
            {
                flag = shatters.LockData(this._sShatterNumber);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            catch (Exception ex2)
            {
                MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            shatters.Dispose();
            if (flag)
            {
                MessageBox.Show("锁定成功", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this._isLocked = true;
                this.chkLockedData.Checked = true;
            }
        }

        private void menuUnLockData_Click(object sender, EventArgs e)
        {
            Shatters shatters = new Shatters();
            bool flag = false;
            try
            {
                flag = shatters.UnLockData(this._sShatterNumber);
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            catch (Exception ex2)
            {
                MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            shatters.Dispose();
            if (flag)
            {
                MessageBox.Show("解锁成功", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this._isLocked = false;
                this.chkLockedData.Checked = false;
            }
        }

        private void lkUpdateRemark_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (this.chkLockedData.Checked)
            {
                MessageBox.Show("此订单已经锁定，不能更改备注！", "提示！", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                string text = InputBox.ShowBox("请输入你要更改的备注...", this.txtRemark.Text);
                if (text != null)
                {
                    Shatters shatters = new Shatters();
                    bool flag = false;
                    try
                    {
                        flag = shatters.UpdateRemark(this._sShatterNumber, text.Trim());
                    }
                    catch (SqlException ex)
                    {
                        MessageBox.Show(ex.Message + "\r\n\r\n或者是连接数据库的通道出现故障，请检查！", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    catch (Exception ex2)
                    {
                        MessageBox.Show(ex2.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    shatters.Dispose();
                    if (flag)
                    {
                        MessageBox.Show("更改备注成功！", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        this.txtRemark.Text = text.Trim();
                    }
                }
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            base.Close();
        }
    }
}
